#ifndef ALARMQUEUE_H
#define ALARMQUEUE_H

#include <QMutex>
#include <QQueue>
#include "common.h"

class AlarmQueue
{
public:
    AlarmQueue();

public:
    static void addAlarm(const AlarmData& data) {
        QMutexLocker locker(&m_mutex);
        m_queue.enqueue(data);
    }

    static QList<AlarmData> takeAll() {
        QMutexLocker locker(&m_mutex);
        auto temp = m_queue;
        m_queue.clear();
        return temp;
    }

private:
    static QQueue<AlarmData> m_queue;
    static QMutex m_mutex;
};

#endif // ALARMQUEUE_H
